package com.tjsinfo.tjsoa.documentationflow.xingzhengfawen.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.json.JSONObject;

import com.tjsinfo.tjsoa.documentationflow.xingzhengfawen.bo.IWenTypeBO;
import com.tjsinfo.tjsoa.documentationflow.xingzhengfawen.vo.MainType;


public class SelectMainTypeByIdActon extends Action{
	
	private IWenTypeBO wenTypeBO;
	
	public IWenTypeBO getWenTypeBO() {
		return wenTypeBO;
	}
	
	
	public void setWenTypeBO(IWenTypeBO wenTypeBO) {
		this.wenTypeBO = wenTypeBO;
	}


	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		Integer id = Integer.parseInt(request.getParameter("id"));
		List<MainType> mainTypeList  = wenTypeBO.selectMainTypeById(id);
		MainType subTypeInfo = mainTypeList.get(0);
		JSONObject object = new JSONObject(subTypeInfo);
		response.getWriter().print(object);
		return null;
	}
	
}


